﻿using Domain.Entitys.Inv;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.EntityConfigurations.Inv
{
    public class InvOthwrConfiguration : IEntityTypeConfiguration<Inv_othwr>
    {
        public void Configure(EntityTypeBuilder<Inv_othwr> builder)
        {
            // 设置表名和主键
            builder.ToTable("Inv_othwr");
            builder.HasKey(e => e.Othwr_id);

            // 配置与明细的关系
            builder.HasMany(e => e.Details)
                   .WithOne(e => e.Main)
                   .HasForeignKey(e => e.Othwr_id);
        }
    }
}
